package LeetCode;

import java.util.Stack;

public class LC_232_ImplementQueueusingStacks {

    public static void main(String[] args) {

    }

    class MyQueue {
        Stack<Integer> stack = new Stack<>();
        Stack<Integer> stack2 = new Stack<>();

        public void push(int x) {
            while (!stack.isEmpty())
                stack2.push(stack.pop());
            stack2.push(x);
            while (!stack2.isEmpty())
                stack.push(stack2.pop());
        }

        public int pop() {
            return stack.pop();
        }

        public int peek() {
            return stack.peek();
        }

        public boolean empty() {
            return stack.isEmpty();
        }
    }

}